package com.deercrowing.takeaway.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import com.deercrowing.takeaway.entity.ShoppingCartEntity;
import org.apache.ibatis.annotations.Update;

import java.util.List;


/**
 * 购物车(ShoppingCart)表数据库访问层
 *
 * @author guoyongxiang
 * @since 2024-07-22 14:11:57
 */
@Mapper
public interface ShoppingCartMapper extends BaseMapper<ShoppingCartEntity> {

    List<ShoppingCartEntity> selectByCondition(ShoppingCartEntity shoppingCartEntity);

    @Update("update tb_shopping_cart set number = #{number} where id = #{id}")
    void updateNumberById(ShoppingCartEntity shoppingCartEntity);

    @Delete("delete from tb_shopping_cart where user_id = #{id}")
    void deleteByUserId(Long id);

    void insertBatch(List<ShoppingCartEntity> shoppingCartEntityList);
}

